<%--
  Created by IntelliJ IDEA.
  User: gaoliwei02
  Date: 16/8/27
  Time: 上午1:16
  To change this template use File | Settings | File Templates.
--%>
<%--
  Created by IntelliJ IDEA.
  User: gaoliwei02
  Date: 16/6/21
  Time: 上午10:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <script type="text/javascript" src="/js/jquery-1.7.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            //传递字符串格式json对象到后台（一个json对象）
            $("#send_data").click(function () {
                var pdataTempture = encodeURI($("#dataTempture").attr("value"));
                var pdataHumidity = encodeURI($("#dataHumidity").attr("value"));
                var pdataAirPm = encodeURI($("#dataAirPm").attr("value"));
                var pdeviceStatus = encodeURI($("#deviceStatus").attr("value"));
                var pdeviceCode = encodeURI($("#deviceCode").attr("value"));
                var psendTime = encodeURI($("#sendTime").attr("value"));
                var preceiveTime = encodeURI($("#receiveTime").attr("value"));

                var data_send = {
                    dataTempture: pdataTempture,
                    dataHumidity: pdataHumidity,
                    dataAirPm: pdataAirPm,
                    deviceStatus: pdeviceStatus,
                    deviceCode: pdeviceCode,
                    sendTime: psendTime,
                    receiveTime: preceiveTime
                };
                var data_json = encodeURI(JSON.stringify(data_send));

                $.ajax({
                    url: "/test.do",
                    data: "Json=" + data_json,
                    dataType: 'text',
                    type: 'GET',
                    timeout: 10000,
                    success: function (data) {
                        alert("rec: " + data);
                    }
                });
            });
        })
    </script>
    <link href="/css/common.css" rel="stylesheet" type="text/css">
</head>

<body class="in_body">
<div class="div_c" style="font-family:微软雅黑">
    <div style="height:400px">

        <form name="test_database">

            <div class="cl"></div>
            <div class="line1"></div>

            <div class="label1">dataTempture：</div>
            <div class="fw"><input name="dataTempture" id="dataTempture" type="text" value="44" style="width:162px"/></div>
            <div class="cl"></div>
            <div class="line1"></div>

            <div class="label1">dataHumidity：</div>
            <div class="fw"><input name="dataHumidity" id="dataHumidity" type="text" value="45" style="width:162px"/></div>
            <div class="cl"></div>
            <div class="line1"></div>

            <div class="label1">dataAirPm：</div>
            <div class="fw"><input name="dataAirPm" id="dataAirPm" type="text" value="46" style="width:162px"/></div>
            <div class="cl"></div>
            <div class="line1"></div>

            <div class="label1">deviceStatus：</div>
            <div class="fw"><input name="deviceStatus" id="deviceStatus" type="text" value="47" style="width:162px"/></div>
            <div class="cl"></div>
            <div class="line1"></div>

            <div class="label1">deviceCode：</div>
            <div class="fw"><input name="deviceCode" id="deviceCode" type="text" value="0001" style="width:162px"/></div>
            <div class="cl"></div>
            <div class="line1"></div>

            <div class="label1">sendTime：</div>
            <div class="fw"><input name="sendTime" id="sendTime" type="text" value="2000-01-02 11:11:15" style="width:162px"/></div>
            <div class="cl"></div>
            <div class="line1"></div>

            <div class="label1">receiveTime：</div>
            <div class="fw"><input name="receiveTime" id="receiveTime" type="text" value="2000-01-02 11:11:15" style="width:162px"/></div>
            <div class="cl"></div>
            <div class="line1"></div>

            <div style="margin-top:20px;color:#bb73b3;width:100%;text-align:right">
                <input id="send_data" type="submit" class="btn" value="发送"/>
            </div>

        </form>
    </div>

</div>
</body>
</html>



